package 夏洛克和括号;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        for (int cases = 1; cases <= T; cases++) {
            long l = in.nextLong();
            long r = in.nextLong();
            long k = Math.min(l, r);
            long res = k * (1 + k) / 2;
            System.out.printf("Case #%d: %d\n", cases, res);
        }
    }
}
